/**
 * Created by apple on 16/5/24.
 */

import template from './editPassword.view.html'
import viewController from './editPassword.controller'

class Controller {
    constructor( ApiService, $cookies, $uiModal) {
        "ngInject"
        this.service = ApiService;
        this.uiModal = $uiModal;

        if (!this.userAccount) {
            this.service.getUserMsg().then((res) => {
                this.userAccount = res.data;
                // this.cookies.putObject('ctgUser', res.data); // User 信息存入缓存
                console.log("返回数据: ", this.userAccount);
            })
        }
    }
    logout() {
        this.service.logout();
    }
    editPassword(){
        let self = this;
        let modalInstance = this.uiModal.open({
            animation   : true,
            templateUrl : template,
            controller  : viewController,
            controllerAs: 'vm',
            size        : '400',
            resolve     : {
                items: () => {
                    return self.userAccount;
                }
            }
        });
    }
}

export default Controller;